home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ccdl151s.zip / SOURCE / EXT.C < prev    next >
C/C++ Source or Header  |  1997-03-15  |  1KB  |  54 lines

  1. /*
  2.  * 68K/386 32-bit C compiler.
  3.  *
  4.  * copyright (c) 1997, David Lindauer
  5.  * 
  6.  * This compiler is intended for educational use.  It may not be used
  7.  * for profit without the express written consent of the author.
  8.  *
  9.  * It may be freely redistributed, as long as this notice remains intact
  10.  * and either the original sources or derived sources 
  11.  * are distributed along with any executables derived from the originals.
  12.  *
  13.  * The author is not responsible for any damages that may arise from use
  14.  * of this software, either idirect or consequential.
  15.  *
  16.  * v1.35 March 1997
  17.  * David Lindauer, gclind01@starbase.spd.louisville.edu
  18.  *
  19.  * Credits to Mathew Brandt for original K&R C compiler
  20.  *
  21.  */
  22. #include <stdio.h>
  23. #include <string.h>
  24. #include "cmdline.h"
  25. /*
  26.  * If no extension, add the one specified
  27.  */
  28. void AddExt(char *buffer, char *ext)
  29. {
  30.   char *pos = strrchr(buffer,'.');
  31.   if (!pos || (*(pos-1) == '.'))
  32.     strcat(buffer, ext);
  33. }
  34. /*
  35.  * Strip extension, if it has one
  36.  */
  37. void StripExt(char *buffer)
  38. {
  39.   char *pos = strrchr(buffer,'.');
  40.   if (pos && (*(pos-1) != '.'))
  41.     *pos = 0;
  42. }
  43. /*
  44.  * Return path of EXE file
  45.  */
  46. void EXEPath(char *buffer, char*filename)
  47. {
  48.   char *temp;
  49.   strcpy(buffer,filename);
  50.   if ((temp = strrchr(buffer,'\\')) != 0)
  51.     *(temp+1) = 0;
  52.   else
  53.     buffer[0] = 0;
  54. }